let musicPhoto=document.querySelector(".musicphoto");
let music=document.querySelector(".music");
let love=document.querySelector(".love");
let afterbutton=document.querySelector(".afterbutton");
let nextbutton=document.querySelector(".nextbutton");
let musicNmae=document.querySelector(".musicnmae");
let loveButton=document.querySelector(".lovebutton");

let musicPhotoData=['images/smile.png','images/img_avatar.png','images/flower.gif','images/twitter1.png'];
let musicData=['music/delete.mp3','music/大风吹.mp3','music/生如夏花.mp3','music/小桥姑娘.mp3'];
let loveData=[false,false,false,false];
let musicNmaeData=['不在犹豫','大风吹','生如夏花','小桥姑娘'];

let curr=0;

afterbutton.addEventListener("click",()=>{
  if(curr==0)curr=3;
  else curr--;
  musicPhoto.src=musicPhotoData[curr];
  music.src=musicData[curr];
  musicNmae.innerHTML=musicNmaeData[curr];
  if(loveData[curr]==true)love.style.backgroundColor="red";
  else love.style.backgroundColor="";
})

nextbutton.addEventListener("click",()=>{
  if(curr==3)curr=0;
  else curr++;
  musicPhoto.src=musicPhotoData[curr];
  music.src=musicData[curr];
  musicNmae.innerHTML=musicNmaeData[curr];
  if(loveData[curr]==true)love.style.backgroundColor="red";
  else love.style.backgroundColor="";
})

loveButton.addEventListener("click",()=>{
  if(loveData[curr]==true){
    love.style.backgroundColor="";
    loveData[curr]=false;
  }
  else{
    love.style.backgroundColor="red";
    loveData[curr]=true;
  }
})